package cc.shimeng.fucloud.service;

import cc.shimeng.fucloud.entity.Classes;
import cc.shimeng.fucloud.repository.ClassesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassesService {

    @Autowired
    private ClassesRepository classesRepository;

    public List<Classes> findAll() {
        return classesRepository.findAll();
    }

    public Classes findById(Integer id) {
        return classesRepository.findById(id).orElse(null);
    }

    public Classes save(Classes classes) {
        return classesRepository.save(classes);
    }

    public void deleteById(Integer id) {
        classesRepository.deleteById(id);
    }
}